
#ifndef __IDT
#  define __IDT

struct __idt_entry {

  unsigned short low_offset;
  unsigned short seg_selector;
  unsigned short flags;
  unsigned short high_offset;

} __attribute__((packed));

#  define __IDT_PRIVLEGED  0x0000
#  define __IDT_PRESENT    0x8000
#  define __IDT_32BIT_GATE 0x0E00

struct __idtr_info {

  unsigned short limit;
  unsigned int base_addr;

} __attribute__((packed));

void _flush_idt();
void _idt_print_idtr();
void _idt_print_idt_entry(unsigned int);
void _store_idt();
void _idt_make_idt_entry(struct __idt_entry *entry, 
			 unsigned short low_offset,
			 unsigned int selector, 
			 unsigned int flags, 
			 unsigned int high_offset);
void _idt_set_idtr_info(unsigned int addr, short limit);
void _idt_init_basic_idt();

void idt_install_idt_entry(unsigned int, void (addr)(), 
			   unsigned short, unsigned short);

/* These are the basic set of interupt handlers for intel interupts. */
void __idt_interrupt_0();
void __idt_interrupt_1();
void __idt_interrupt_3();
void __idt_interrupt_4();
void __idt_interrupt_5();
void __idt_interrupt_6();
void __idt_interrupt_7();
void __idt_interrupt_8();
void __idt_interrupt_9();
void __idt_interrupt_10();
void __idt_interrupt_11();
void __idt_interrupt_12();
void __idt_interrupt_13();
void __idt_interrupt_14();
void __idt_interrupt_16();


#endif
